package com.prs.crm.context;

import org.apache.struts2.ServletActionContext;
import org.springframework.context.ApplicationContext;
import org.springframework.web.context.support.WebApplicationContextUtils;

public class BeanFactory {

	private static ApplicationContext applicationContext;
	
	public static Object getBean(String name)
	{
		if (applicationContext==null)
		{
			applicationContext = WebApplicationContextUtils
	          .getWebApplicationContext(ServletActionContext.getServletContext());
		}
		return applicationContext.getBean(name);
	}
	
}
